<?php
header('Content-type:text/html;charset=utf-8;');

//包含数据库配置
include '../../public/peizhi.php';

//包含函数
include '../../public/func.php';

//调用函数
$link = db();

//接值并判断用户
if(empty($_REQUEST['uid'])){
	exit('<script>alert("没有用户或没有选择用户");window.location.href="show.php";</script>');
}

$uid = $_REQUEST['uid'];

//准备SQL语句
if(!empty($uid)){
	if(is_array($uid)){
		$sumuid = implode(',',$uid);
		$sql = "delete from user where id in({$sumuid})";
	}else{
		$sumuid = $uid;
		$sql = "delete from user where id in({$sumuid})";
	}
}

//执行SQL语句
if($res = mysqli_query($link,$sql)){
	echo '<script>alert("删除用户成功");window.location.href="show.php";</script>';
}else{
	echo '<script>alert("删除用户失败");window.location.href="show.php";</script>';
}

//关闭数据库连接
mysqli_close($link);


